<!DOCTYPE html>
<html>
    <head>	
        <title>{:C('SERVER_HOME_NAME')}</title>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/style.css" />
        <link href="__PUBLIC__/css/common.css" type="text/css" rel="stylesheet"/>
        <link href="__PUBLIC__/css/index.css" type="text/css" rel="stylesheet"/> 		
    </head>
    <body>
        <div class="box">
            <include file="Public/top" />
            <div class="content">
                <include file="leftNav" />
                <div class="main p30">
                    <h3>公司信息<span>所有信息为必填，否则不能保存</span></h3>
                    
                    <form action="__URL__/companyInfo" method="post"  id="myform">
                        <input type="hidden" name="id" value="{$companyInfo.id}">
                        <div class="company">
                            <div class="form-group"><span class="form-title">公司名称：</span><input type="text" name="company_name" value="{$companyInfo.company_name}"></div>
                            <div class="form-group"><span class="form-title">公司网址：</span><input type="text" name="company_url" value="{$companyInfo.company_url}"></div>
                            <div class="form-group"><span class="form-title">注册号：</span><input type="text" name="regist_num" value="{$companyInfo.regist_num}"></div>
                            <div class="form-group"><span class="form-title">注册地址：</span><input type="text" name="regist_address" value="{$companyInfo.regist_address}"></div>
                            <div class="form-group"><span class="form-title">法人代表：</span><input type="text" name="legal_person" value="{$companyInfo.legal_person}"></div>
                                
                            <div class="form-group"><span class="form-title">电话座机：</span><input type="text" name="Landline" value="{$companyInfo.Landline}"></div>
                            <div class="form-group"><span class="form-title">成立日期：</span><input type="text"   name="build_time" value="{$companyInfo.build_time}"  placeholder="请选择日期" readonly  id="test1"></div>
                            	
                            <div class="form-group"><span class="form-title">经营范围：</span><textarea name="business_area">{$companyInfo.business_area}</textarea></div>	              
                            <div class="btn-form"><a href="javascript:void(0);"  class="btn">保存</a></div>
                        </div>
                    </form>	

                </div>
            </div>
<include file="Public/ok" />
            <script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.min.js"></script>
            <script src="__PUBLIC__/js/page.js"></script>
            <script src="__PUBLIC__/laydate/laydate.js"></script>
            <script>
                  laydate.render({
                          elem: '#test1' //指定元素
                        });
        //调试调用 
                    $(function(){
                        $(".btn").click(function(){
                            $.ajax({
                                type: "POST",
                                url:"__URL__/companyInfo",
                                data:getFormJson($("#myform")),//表单数据JSON格式的函数参数里填写表单的ID或要提交的表单
                                dataType: 'json',
                                success: function(msg) {
                                    modelConfirm(msg.info); 
                                    if(msg.status == 200) {  
                                        setTimeout(function() {
						  window.location.href="__URL__/certificatesInfo";
					},3000);  
                                    }
                                },
                                error: function(error){modelConfirm(error); }
                             });
                        });
                    });
                  
                // ps:注意将同名的放在一个数组里
                function getFormJson(form) {
                    var o = {};
                    var a = $(form).serializeArray();
                    $.each(a, function () {
                    if (o[this.name] !== undefined) {
                    if (!o[this.name].push) {
                    o[this.name] = [o[this.name]];
                    }
                    o[this.name].push(this.value || '');
                    } else {
                    o[this.name] = this.value || '';
                    }
                    });
                    return o;
                }
            </script>	
    </body>
</html>